package com.translate.web.api.controller;


import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.response.vo.ResponseModel;
import com.controller.base.AbstractController;
import com.translate.entity.User;
import com.page.PageResponseData;
import com.translate.web.param.CommunicationsManBySearchParam;
import com.translate.web.param.DepartmentCommunicationsParam;
import com.param.impl.PageParam;
import com.translate.web.service.ICommunicationUserService;
import com.basic.service.contract.IBaseService;
import com.translate.vo.ContactsHumanVO;

/**
 * 公司通讯录
 * @author 111
 */
@RestController
@RequestMapping("/companyAddressBook")
public class CompanyAddressBookController extends AbstractController<User, CommunicationsManBySearchParam, PageParam> {
	
	private ICommunicationUserService userService;
	
	public CompanyAddressBookController(ICommunicationUserService userService) {
		this.userService = userService;
	}
	
	
	/**
	 * 获取部门通讯人员列表
	 * @param param
	 * @return 20023212
	 */
	@PostMapping("/departmentCommunications")
	public ResponseModel<PageResponseData<ContactsHumanVO>> departmentCommunications(@RequestBody @Validated DepartmentCommunicationsParam param) {
		return ResponseModel.<PageResponseData<ContactsHumanVO>>success(this.userService.departmentCommunications(param, ContactsHumanVO.class));
	}
	
//	/**
//	 * 通讯搜索
//	 * @param param
//	 * @return
//	 */
//	@PostMapping("/communicationsManBySearch")
//	public ResponseModel<List<ContactsHumanVO>> communicationsManBySearch(@RequestBody @Validated CommunicationsManBySearchParam param) {
//		return ResponseModel.<List<ContactsHumanVO>>success(this.userService.topLeavel(param, ContactsHumanVO.class));
//	}

	@Override
	protected IBaseService<User> getBaseService() {
		// TODO Auto-generated method stub
		return this.userService;
	}
	
	@SuppressWarnings("unchecked")
	protected <VO> Class<VO> getTarget() {
		return (Class<VO>) ContactsHumanVO.class;
	}
	
}
